package routes

import (
	"github.com/gin-gonic/gin"
	"goodcenter/internal/handler"
)

func InitRouter(ginRouter *gin.Engine) {
	// 用户
	goodcenterV1 := ginRouter.Group("/goodcenter/v1")
	{
		// 公开组
		goodcenterV1Nil := goodcenterV1.Group("/nil")
		{
			goodcenterV1Nil.GET("/good/list", handler.GoodList)
			goodcenterV1Nil.GET("/good/detail/:id", handler.GoodDetail)

			goodcenterV1Nil.Static("/image", "./static/image")
		}

		//// 鉴权组
		//goodcenterV1Def := goodcenterV1.Group("/def")
		//{
		//}

		// 系统组（不对外公开，内网访问）
		goodcenterV1Sys := goodcenterV1.Group("/sys")
		{
			goodcenterV1Sys.POST("/good", handler.GoodInsert)
			goodcenterV1Sys.POST("/good/:id", handler.GoodUpdate)
			goodcenterV1Sys.DELETE("/good/:id", handler.GoodDelete)
			goodcenterV1Sys.PUT("/good/picture", handler.Upload)
		}
	}
}
